package com.moli.lumpSugar;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;

import javax.annotation.PostConstruct;

/**
 * @author zhangjt
 * @date 2021/05/27
 */
@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients(basePackages = "com.moli.lumpSugar.api.**")
@ComponentScan(
        excludeFilters = @ComponentScan.Filter(
                type = FilterType.REGEX,
                pattern = {"com\\.moli\\.lumpSugar\\.common\\.interceptor\\..*"}  // 排除 interceptor 包中的所有类
        )
)
public class LumpSugarGateWayApplication {
    @Autowired
    private DiscoveryClient discoveryClient;

    public static void main(String[] args) {
        SpringApplication.run(LumpSugarGateWayApplication.class,args);
    }
    @PostConstruct
    public void logDiscoveryInfo() {
        System.out.println("Registered services: " + discoveryClient.getServices());
    }

}